package com.huffman.smart_picture.domain.constants;

import cn.hutool.core.io.resource.ResourceUtil;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.core.script.RedisScript;

/**
 * @author DengLin
 * @date 2025/1/22 13:19
 * @description: redis 相关常量
 */
public class RedisConstant {
    public static final String MODULE_NAME = "smart-picture";

    public static final String REGISTER_CHECK_CODE = "userRegisterCheckCode";

    public static final String PICTURE_VO_PAGE_QUERY_BY_USER = "pictureVoPageQueryByUser";

    public static final String FAVORITE_PICTURE_RECORD = "favoritePictureRecord";

    public static final String TEMP_FAVORITE_PICTURE_RECORD_KEY = "record:temp:%s";

    public static final String TEMP_USER_RECORD_KEY = "record:user:%s";

    public static final String DASHBOARD_COUNT_KEY = "dashboard:count";

    public static final String DASHBOARD_USER_RATIO_KEY = "dashboard:user:ratio";

    public static final String DASHBOARD_SPACE_RATIO_KEY = "dashboard:space:ratio";

    public static final long ONE_MINUTE = 60 * 1000L;

    public static final RedisScript<Long> DO_FAVORITE_SCRIPT = new DefaultRedisScript<>(
            ResourceUtil.readUtf8Str("script/doFavorite.lua"),
            Long.class);

    public static RedisScript<Long> UNDO_FAVORITE_SCRIPT = new DefaultRedisScript<>(
            ResourceUtil.readUtf8Str("script/undoFavorite.lua"),
            Long.class);

}
